<?php

if (!session('indebug')) return;

header("Content-type: text/html; charset=utf-8"); 

?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
	<meta charset="utf-8">
	<title>调试页面:<?= session_id()?></title>
<style>
.frame{border:1px solid #ddd;background:#f8f8f8;margin:0px 0px 3px 0px;padding:3px 15px;}
.frame p {}
</style>
</head>
<body>
<h1 style="text-align:center"> 调试：<?=$config['site_name'] ?></h1>
<a href="?cleanup=true"> 清理 </a>
<a href="?false=true"> 刷新 </a>
<hr>

<?php

$did = intval(session('debugid')); 
for($i = DEBUG_PAGES - 1; $i >= 0;  $i--){
	$id = ($i + $did) % 5;
	if (param('cleanup')) {
		session("debugmsg{$id}", null);  
	}else{
		echo "<div class='frame'>";
		$msg = session("debugmsg{$id}");  
		if ($msg && is_array($msg)) foreach($msg as $line) echo "<p> $line </p>";
		echo "</div>";
	}
}

if (param('cleanup')) {
	echo "<h1>session</h1><hr>";
	print_r($_SESSION);
	echo "<h1>server</h1><hr>";
	print_r($_SERVER);
}

?>

</body></html>


<?php 
exit;

